<template>
	<view class="mine">
		<image class="bgimg" src="../../static/image/mineBg.png" mode=""></image>
		<view class="mineBox">
			<view class="navBarBox">
				个人中心
			</view>

			<view class="mineData" @click="handleSystem">
				<image :src="userInfo.avatar" style="width: 160rpx; height: 160rpx;border-radius: 160rpx;"
					mode="aspectFill">
				</image>
				<view class="" style="margin-left: 20rpx;width: 450rpx;">
					<view class="">
						{{userInfo.nickname}}
					</view>
					<view class="">
						{{userInfo.mobile}}
					</view>
				</view>
				<image src="../../static/image/rigth_w.png" mode="" style="width: 40rpx;height: 40rpx;"></image>
			</view>

			<view class="myOrder">
				<view class="titleBox">
					<view class="title">
						我的订单
					</view>
					<view class="title_right" @click="handleOrderList(0)">
						<view class="">
							全部
						</view>
						<image src="../../static/image/right.png" mode="" style="width: 20rpx;height: 20rpx;"></image>
					</view>
				</view>
				<view class="orderBox">
					<view class="orderItem" @click="handleOrderList(0)">
						<image src="../../static/image/dfk.png" style="width: 60rpx;height: 60rpx;" mode=""></image>
						<view class="">
							全部
						</view>
					</view>
					<view class="orderItem" @click="handleOrderList(2)">
						<image src="../../static/image/dfh.png" style="width: 60rpx;height: 60rpx;" mode=""></image>
						<view class="">
							待发货
						</view>
						<view class="box">
							<u-badge :type="type" max="99" :value="count" bgColor="red"></u-badge>
						</view>
					</view>
					<view class="orderItem" @click="handleOrderList(3)">
						<image src="../../static/image/dsh.png" style="width: 60rpx;height: 60rpx;" mode=""></image>
						<view class="">
							待收货
						</view>
						<view class="box" style="right: 30rpx;">
							<u-badge :type="type" max="99" :value="count1" bgColor="red"></u-badge>
						</view>
					</view>
					<view class="orderItem" @click="handleOrderList(4)">
						<image src="../../static/image/dpj.png" style="width: 60rpx;height: 60rpx;" mode=""></image>
						<view class="">
							待评价
						</view>

					</view>
					<!-- <view class="orderItem" @click="handleAftersalelist">
						<image src="../../static/image/tksh.png" style="width: 60rpx;height: 60rpx;" mode=""></image>
						<view class="">
							退款/售后
						</view>
					</view> -->

				</view>

			</view>


			<view class="myServe">

				<view class="title">
					我的服务
				</view>

				<view class="serveBox">
					<view class="serveItem" @click="handleAddress">
						<image src="../../static/image/shdz.png" style="width: 70rpx;height: 70rpx;" mode=""></image>
						<view class="">
							收货地址
						</view>
					</view>
					<view class="serveItem" @click="handleGonggao">
						<image src="../../static/image/ptgg.png" style="width: 70rpx;height: 70rpx;" mode=""></image>
						<view class="">
							平台公告
						</view>
					</view>
					<view class="serveItem" @click="handleSystem">
						<image src="../../static/image/xtsz.png" style="width: 70rpx;height: 70rpx;" mode=""></image>
						<view class="">
							系统设置
						</view>
					</view>
					<view class="serveItem" @click="handleKf">
						<image src="../../static/image/kf.png" style="width: 70rpx;height: 70rpx;" mode=""></image>
						<view class="">
							客服
						</view>
					</view>

					<view class="serveItem" @click="handleShare">
						<image src="../../static/image/share.png" style="width: 70rpx;height: 70rpx;" mode=""></image>
						<view class="">
							邀请
						</view>
					</view>
					<view class="serveItem" @click="handleMyteam">
						<image src="../../static/image/team.png" style="width: 70rpx;height: 70rpx;" mode=""></image>
						<view class="">
							我的团队
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		userinfo,
		orderCount
	} from "@/api/api.js"
	export default {
		data() {
			return {
				userInfo: {},
				type: "warning",
				count: 0,
				count1: 0,

			}
		},
		onShow() {
			this.handleuserinfo()
			this.handleorderCount()
		},
		onLoad() {},
		methods: {
			async handleuserinfo() {
				let res = await userinfo()
				this.userInfo = res.data
				this.userInfo.mobile = this.userInfo.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
			},
			async handleorderCount() {
				let res = await orderCount()
				this.count = res.data.count
				this.count1 = res.data.count1
			},
			handleOrderList(index) {
				uni.navigateTo({
					url: `./myorderList?index=${index}`
				})
			},
			handleAftersalelist() {
				uni.navigateTo({
					url: "./afterSaleList"
				})
			},
			handleAddress() {
				uni.navigateTo({
					url: "./addressList"
				})
			},
			handleGonggao() {
				uni.navigateTo({
					url: "./announcementList"
				})
			},
			handleSystem() {
				uni.navigateTo({
					url: "./system"
				})
			},
			handleShare() {
				uni.navigateTo({
					url: "./myshare"
				})
			},
			handleMyteam() {
				uni.navigateTo({
					url: "./myteam"
				})
			},
			handleKf() {
				uni.navigateTo({
					url: "./concatUs"
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.mine {
		width: 100%;
		height: 100%;

		.bgimg {
			width: 100%;
			height: 100%;
		}

		.mineBox {
			position: absolute;
			top: 0;
			width: 100%;
			height: 100%;
			display: flex;
			flex-direction: column;

			.navBarBox {
				width: 128rpx;
				height: 88rpx;
				font-size: 32rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 88rpx;
				margin-left: 310rpx;
			}

			.mineData {
				width: 100%;
				height: 160rpx;
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				box-sizing: border-box;
				font-size: 32rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 38rpx;
			}

			.myOrder {
				width: 100%;
				height: 226rpx;
				background: #FFFFFF;
				border-radius: 40rpx 40rpx 0rpx 0rpx;
				margin-top: 30rpx;
				padding: 30rpx 40rpx;
				box-sizing: border-box;

				.titleBox {
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 33rpx;
				}

				.title_right {
					display: flex;
					align-items: center;
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #BBBBBB;
					line-height: 33rpx;
				}

				.orderBox {
					display: flex;
					width: 100%;
					justify-content: space-between;
					font-size: 24rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 52rpx;
					margin-top: 30rpx;

					.orderItem {
						width: 25%;
						display: flex;
						align-items: center;
						flex-direction: column;
						position: relative;

						.box {
							position: absolute;
							right: 30rpx;
							top: -10rpx;
						}
					}
				}
			}


			.myServe {
				width: 100%;
				flex-grow: 1;
				background-color: #ffffff;
				margin-top: 12rpx;
				padding: 38rpx;
				box-sizing: border-box;

				.title {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 33rpx;
				}

				.serveBox {
					width: 100%;
					margin-top: 30rpx;
					display: flex;
					flex-wrap: wrap;
					// justify-content: space-between;

					.serveItem {
						width: 25%;
						display: flex;
						flex-direction: column;
						align-items: center;
						font-size: 24rpx;
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						color: #333333;
						line-height: 40rpx;
						margin-bottom: 20rpx;
					}
				}
			}

		}
	}
</style>